//
//  JSOrderFooterView.m
//  jshop
//
//  Created by 张艳江 on 2019/5/21.
//  Copyright © 2019 张艳江. All rights reserved.
//

#import "SCOrderFooterView.h"

@implementation SCOrderFooterView

+ (instancetype)addOrderFooterView{
    return [[NSBundle mainBundle]loadNibNamed:@"SCOrderFooterView" owner:nil options:nil].lastObject;
}
- (void)setModel:(SCModel *)model{
    
    _model = model;
    if ([model.type intValue] == 1) {
        self.desLab.text = [NSString stringWithFormat:@"共%d件商品  合计：%@",model.count,model.sum];
    }else{
        self.desLab.text = [NSString stringWithFormat:@"共%d件商品  合计：¥%@",model.count,model.sum];
    }
    if ([model.status intValue] == 1) {
        [self.rightBtn setTitle:@"立即支付" forState:0];
        self.cancelBtn.hidden = NO;
        self.rightBtn.hidden = NO;
        self.leftBtn_right.constant = 166;
    }else if ([model.status intValue] == 4){
        [self.rightBtn setTitle:@"立即评价" forState:0];
        self.rightBtn.hidden = NO;
        self.cancelBtn.hidden = YES;
        self.leftBtn_right.constant = 89;
    }else{
        self.rightBtn.hidden = YES;
        self.cancelBtn.hidden = YES;
        self.leftBtn_right.constant = 12;
    }
}
- (IBAction)clickBtns:(UIButton *)sender {
   
    if ([self.delegate respondsToSelector:@selector(clickButtonWithSection:button:)]) {
        [self.delegate clickButtonWithSection:self.tag button:sender];
    }
}

@end
